﻿ // JavaScript Document 
var clicknow=0;

// ------菜单-------------

//search Div
jQuery(function($){
   $("#searchinput").keypress(function(e){
	 $("#search_result").fadeIn(60); 
	 hidAll();
	 pshow_hid();
   });


   $("#search_result").mouseover(function(e){
	 document.getElementById('search_result').style.display="block";
	   hidAll();
	  pshow_hid();
   });
     
   
});
//search Div


//品牌显示
jQuery(function($){


   $("#shuanghua_news").mouseover(function(e){
	 	$("#shuanghua_news").addClass("a1");
		 $("#shuanghua_lists").removeClass("a2");
		 $("#shuanghua_lists_area").hide();
		 $("#shuanghua_news_area").show();
		 $("#shuanghua_ss").removeClass("a2");
		 $(".pop_shuanghua").hide();

		$(".mouse_tab_think").mouseover(function (){
			$("#shuanghua_news").addClass("a1");
			$("#shuanghua_news_area").show();
		}).mouseout(function(){
			$("#shuanghua_news_area").hide();
			$("#shuanghua_news").removeClass("a1");
		});

		$("#pshow_0").mouseover(function (){
			$("#shuanghua_news_area").hide();
			$("#shuanghua_news").removeClass("a1");
		});

	 	 thinksta = 1;
     	 search_hid();
		 hidAll();
   });
   

   
    $("#shuanghua_lists").mouseover(function(e){
	 	$("#shuanghua_lists").addClass("a2");
	 	$("#shuanghua_news").removeClass("a1");
		$("#shuanghua_news_area").hide();
		$("#shuanghua_lists_area").show();
		
		$("#shuanghua_ss").removeClass("a2");
		 $(".pop_shuanghua").hide();

		$(".mouse_tab_idea").mouseover(function (){
			$("#shuanghua_lists_area").show();
			$("#shuanghua_lists").addClass("a2");
		}).mouseout(function(){
			$("#shuanghua_lists_area").hide();
			$("#shuanghua_lists").removeClass("a2");
		});

		thinksta = 1;
		search_hid();
		hidAll();
   });
   
   $("#shuanghua_ss").mouseover(function(e){
	 	$("#shuanghua_ss").addClass("a2");
		
		$("#shuanghua_news").removeClass("a1");
		$("#shuanghua_news_area").hide();
		$("#shuanghua_lists").removeClass("a2");
		 $("#shuanghua_lists_area").hide();
		 
		$(".pop_shuanghua").show();

		$(".pop_shuanghua").mouseover(function (){
			$(".pop_shuanghua").show();
			$(".shuanghua_ss").addClass("a2");
		}).mouseout(function(){
			$(".pop_shuanghua").hide();
			$(".shuanghua_ss").removeClass("a2");
		});

		thinksta = 1;
		search_hid();
		hidAll();
   });
	
});


$(document).ready(function() { 
        $('#shuanghua_news_area .l h1').each(function(){ 
                $(this).click( 
                    function(){
						var idname = $(this).attr('id'); 
						pname = "#"+idname+"_list";
						pcon = "#con_"+idname;
						if($(this).attr('id')!="p_t_nv4"){
						for (i=0;i<=4;i++){ 
						$("#p_t_nv"+i+"_list").addClass("hidd");//con_p_t_nv0
						$("#con_p_t_nv"+i).addClass("hidd");
						}
						
						$(pname).removeClass("hidd"); 
						$(pname).addClass("show"); 
						$(pcon).removeClass("hidd"); 
						$(pcon).addClass("show");}
                        }); 
         }); 
          
}); 

$(document).ready(function() { 
        $('#shuanghua_lists_area .l h1').each(function(){ 
                $(this).click( 
                    function(){
						var idname = $(this).attr('id'); 
						pname = "#"+idname+"_list";
						pcon = "#con_"+idname;
						if($(this).attr('id')!="p_i_nv3"){
						for (i=0;i<=3;i++){ 
						$("#p_i_nv"+i+"_list").addClass("hidd");//con_p_t_nv0
						$("#con_p_i_nv"+i).addClass("hidd");
						$("#p_i_nv"+i).removeClass("shuanghua_lists_infor1");
						$("#p_i_nv"+i).css({background:"none"});
						}
						
						$(pname).removeClass("hidd"); 
						$(pname).addClass("show"); 
						$(pcon).removeClass("hidd"); 
						$(pcon).addClass("show");
						}
						//if($(this).attr('id')=="p_i_nv3"){
						//	$("#p_i_nv3").removeClass("shuanghua_lists_infor");
						//	$("#p_i_nv3").addClass("shuanghua_lists_infor1");
							//$("#p_i_nv3").css({background:"#426180"});
							//}
						
                        }); 
         }); 
          
}); 
//品牌



//显示遮罩
function disableBodyArea(f){
	var bodyH=$("body").height()+300;
	var screemH=window.screen.availHeight;
	var maxH = (bodyH > screemH) ? bodyH : screemH;
	document.getElementById('topCoverDiv').style.height=maxH+"px" ;
	
	if(f){
		$("#topCoverDiv").fadeIn(300); 
		}else{
		$("#topCoverDiv").fadeOut(300); 
	}

}
//tab切换
$(document).ready(function() { 
        $('#tab li').each(function(){ 
                $(this).click( 
                    function(){
						var idname = $(this).attr('id');
						//alert(tabnum);
						divname = "#con"+idname;

						for (i=1;i<=tabnum;i++){ 
						$("#contab_"+i).addClass("hidd");
						$("#tab_"+i).removeClass("tab_a_1");
						$("#tab_"+i).addClass("border_r");
						}
						$(divname).removeClass("hidd"); 
						$(divname).addClass("show"); 
						//$("#_"+idname).removeClass("border_r"); 
						$("#"+idname).addClass("tab_a_1");
                        }); 
         }); 
          
}); 

/* 滑出菜单 */	
jQuery(function($){
   $("#show_p_type").mousemove(function(e){
	var par,par_ar;
	 var par = $('#show_p_type').attr('name');  //获取控制位置
	  par_ar = par.split("_");
	  margin_top =  par_ar[0];
	  margin_left = par_ar[1];
	  margin_left_ie6 = par_ar[2];
	  $("#p_sub_nav").css({"margin-top": margin_top+"px","margin-left":margin_left+"px","_margin-left":margin_left+"px","*margin-left":margin_left_ie6+"px"}); 
		$("#p_sub_nav").removeClass("hidd");//显示控制
	 	$("#p_sub_nav").addClass("show");

      });
   
   $("#hid_1,#hid_2,#hid_3").mousemove(function(e){
   $("#p_sub_nav").removeClass("show");
   $("#p_sub_nav").addClass("hidd");
   }); 
  
  
    });

$(document).ready(function() { 
        $('#p_sub_nav_bg tr td .inner tr td #sub_nav li').each(function(){ 
                $(this).mouseover( 
                    function(){
						var idname = $(this).attr('id');
						divname = "#sub_nav"+idname;
						for (i=1;i<=subnum;i++){ 
						$("#sub_nav_"+i).addClass("hidd");
						}
						$(divname).removeClass("hidd"); 
						$(divname).addClass("show"); 
                      }); 
				
         }); 
          
});
/* 选择范围菜单 */	
jQuery(function($){
   $("#side_menu_ctrl").click(function(e){
	var par,par_ar;
	 var par = $('#side_menu_ctrl').attr('name');
	  par_ar = par.split("_");
	  margin_top =  par_ar[0];
	  margin_left = par_ar[1];
	  margin_top_ie6 = par_ar[2];
	 //alert(par);
	    $("#side_menu").css({"margin-top": margin_top+"px","margin-left":margin_left+"px","_margin-left":margin_left+"px","*margin-top":margin_top_ie6+"px"}); 


		$("#side_menu").removeClass("hidd");
	 	$("#side_menu").addClass("show");
		//alert("dd");

      });
   
   $("#select_1,#select_2,#select_3").mousemove(function(e){
   $("#side_menu").removeClass("show");
   $("#side_menu").addClass("hidd");
   }); 
  
  
  
    });

$(document).ready(function() { 
        $('#range h2 a').each(function(){ 
                $(this).click( 
                    function(){
						var idname = $(this).attr('id'); 
						//alert (idname);
						for (i=1;i<=selectnum;i++){ 
						$("#bar_"+i).removeClass("show");
						$("#bar_"+i).addClass("hidd");
						$("#_"+i).removeClass("alt");
						}
						$("#bar"+idname).removeClass("hidd");
						$("#bar"+idname).addClass("show");
						$("#"+idname).addClass("alt"); 

                        }); 
         }); 
          
}); 

//产品展示

function initPhoto(n){
	
	if(n<14){
	  w = n*60;
	  mgl = (1002-w)/2;
		$("#m_area").css({"width": w+"px","margin-left":mgl+"px","overflow":"hidden","float":"left","display":"inline"}); 	
	  	$("#m_area ul").css({"width": w+"px","margin":"0 auto"}); 	

	}else{
		w = maxphoto*60;
		wall =n*60; 
		$(".photo_ctrl .m").css({"width": w+"px","margin":"0 auto","overflow":"hidden","margin-left":"50px","display":"inline"}); 	
	    $(".photo_ctrl .m ul").css({"width": wall+"px","margin":"0 auto"}); 	
           
		   for(i=maxphoto+1;i<=n;i++){
			   $('#_'+i+' span').css({"display":"none"});
			   }
	}
	if(n>14){
		 $(".photo_ctrl .r") .css({"display":"block"});
		 $(".photo_ctrl .l") .css({"display":"block"});
	}
}

$(document).ready(function() { 
					   
        $('.photo_ctrl.clear ul li a').each(function(){ 
                $(this).click( 
                    function(){
						var idname = $(this).attr('id');
						clicknow =idname; 
						var idl =$(this).attr('name')-1; //给箭头赋值左
						
							if(idl==0){$("#go_per").fadeOut(0);}else{$("#go_per").fadeIn(0);}
								var idr =parseInt($(this).attr('name'))+1;//给箭头赋值右
								if(idr==photonum+1){$("#go_nex").fadeOut(0);}else{$("#go_nex").fadeIn(0);	}
								
									$("#go_per").attr('title',idl);
									$("#go_nex").attr('title',idr);
						
										for (i=1;i<=photonum;i++){ 
										$("#p_"+i).fadeOut(0);
										$("#_"+i+" "+"span").removeClass("nomask");
										$("#l_"+i).removeClass("photo_border2");
										}
									$("#p"+idname).fadeIn(300);
									$("#"+idname+" "+"span").addClass("nomask");
									$("#l"+idname).addClass("photo_border2");
						
                        }); 
         }); 
		//向前
		  $("#go_per").click(function(e){
						var goid = parseInt($(this).attr('title'));
						var idl =goid-1; //给箭头赋值左
						clicknow ="_"+goid; 
							if(idl==0){$("#go_per").fadeOut(0);}else{$("#go_per").fadeIn(0);}
									var idr =goid+1;//给箭头赋值右
							
									if(idr==photonum+1){$("#go_nex").fadeOut(0);}else{$("#go_nex").fadeIn(0);	}
											$("#go_per").attr('title',idl);
											$("#go_nex").attr('title',idr);
													for (i=1;i<=photonum;i++){ 
															$("#p_"+i).fadeOut(0);
															$("#_"+i+" "+"span").removeClass("nomask");
															$("#l_"+i).removeClass("photo_border2");
															//document.getElementById("p_"+i).style.display="none";
													}
											$("#p_"+goid).fadeIn(300);
											$("#_"+goid+" "+"span").addClass("nomask");
											$("#l_"+goid).addClass("photo_border2");
						});
		 
		   $("#go_nex").click(function(e){
									   
							var goid = parseInt($(this).attr('title'));
							clicknow ="_"+goid; 
							var idl =goid-1; //给箭头赋值左
							if(idl==0){
									$("#go_per").fadeOut(0);
								}else{
									$("#go_per").fadeIn(0);
								}
								
							var idr =goid+1;//给箭头赋值右
							
							if(idr==photonum+1){
								$("#go_nex").fadeOut(0);
									}else{
								$("#go_nex").fadeIn(0);	
									}
								
							$("#go_per").attr('title',idl);
							$("#go_nex").attr('title',idr);
							
						for (i=1;i<=photonum;i++){ 
							$("#p_"+i).fadeOut(0);
							$("#_"+i+" "+"span").removeClass("nomask");
							$("#l_"+i).removeClass("photo_border2");
						}
							$("#p_"+goid).fadeIn(300);
							$("#_"+goid+" "+"span").addClass("nomask");
							$("#l_"+goid).addClass("photo_border2");
			});
		
		 
		  $('.photo_ctrl.clear ul li a').each(function(){ 
                $(this).mouseover(   function(){
						var idname = $(this).attr('id');	  
						for (i=1;i<=photonum;i++){ 
							$("#_"+i+" "+"span").removeClass("nomask");
							$("#l_"+i).removeClass("photo_border2");
						}
							$("#"+idname+" "+"span").addClass("nomask");
							$("#l"+idname).addClass("photo_border2");
					 
						 }
							  
			 )})
		  
		   $('.photo_ctrl.clear ul li a').each(function(){ 
                $(this).mouseout(   function(){
						var idname = $(this).attr('id');	  
						for (i=1;i<=photonum;i++){ 
							$("#_"+i+" "+"span").removeClass("nomask");
							$("#l_"+i).removeClass("photo_border2");
						}
							
					 $("#"+clicknow+" "+"span").addClass("nomask");
							$("#l"+clicknow).addClass("photo_border2");
						 }
							  
			 )})
		
		
  $("#ctrl_l").click(function(e){ 
							  
				headid = $(this).attr('name');	
				endid = parseInt($("#ctrl_r").attr('name'))+1;	
				
				if(endid<photonum+1){
					movel = movel+1;
					mover = 0;
					mg = movel*60;
					$(".photo_ctrl .m ul").css({"margin-left":"-"+mg+"px"});
					$('#_'+headid+' span').css({"display":"none"});
					$('#_'+endid+' span').css({"display":"block"});
					headid = parseInt(headid)+1;
					endid = parseInt(endid);
					 $("#ctrl_l").attr('name',headid)
					 $("#ctrl_r").attr('name',endid)
					 $("#ctrl_r").css({"display":"block"});	
					}else if(endid==photonum+1){
					$("#ctrl_l").css({"display":"none"});	
					}
							  

							  
	}) 
  
    $("#ctrl_r").click(function(e){ 
							
				headid = $("#ctrl_l").attr('name');	
				endid = parseInt($("#ctrl_r").attr('name'));
				if(headid>1){
					mover = mover+1;
					movel = 0;
					mg = (headid-2)*60;
					headid = parseInt(headid)-1;
					$(".photo_ctrl .m ul").css({"margin-left":"-"+mg+"px"});
					$('#_'+endid+' span').css({"display":"none"});
					$('#_'+headid+' span').css({"display":"block"});
					endid = parseInt(endid)-1;
					$("#ctrl_l").attr('name',headid)
					 $("#ctrl_r").attr('name',endid)
					 $("#ctrl_l").css({"display":"block"});	
					}else if(headid==1){
					$("#ctrl_r").css({"display":"none"});		
						
				}	
					
							  
    })  
});
